{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "346377c6-e7c9-46e1-9c7b-d786827f1d52",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "os.chdir('..')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7ff58a0a-87a5-419b-8f20-88ffadf54051",
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain.chains import GraphCypherQAChain\n",
    "from langchain.chat_models import ChatOpenAI\n",
    "from langchain.graphs import Neo4jGraph\n",
    "from langchain.callbacks import get_openai_callback\n",
    "from dotenv import load_dotenv\n",
    "import os\n",
    "import openai\n",
    "import pandas as pd\n",
    "from neo4j.exceptions import CypherSyntaxError\n",
    "from kg_rag.utility import *\n",
    "from tqdm import tqdm\n",
    "import pandas as pd\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1d905ac1",
   "metadata": {},
   "source": [
    "## Choose the LLM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "id": "763d7ad7",
   "metadata": {},
   "outputs": [],
   "source": [
    "LLM_MODEL = 'gpt-4-32k'\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f02bd807",
   "metadata": {},
   "source": [
    "## Load test data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 146,
   "id": "43772231",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv('../data/rag_comparison_data.csv')\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8bb1d1e3",
   "metadata": {},
   "source": [
    "## Custom function for neo4j RAG chain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "id": "611fee8c",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_neo4j_cypher_rag_chain():\n",
    "    load_dotenv(os.path.join(os.path.expanduser('~'), '.spoke_neo4j_config.env'))\n",
    "    username = os.environ.get('NEO4J_USER')\n",
    "    password = os.environ.get('NEO4J_PSW')\n",
    "    url = os.environ.get('NEO4J_URI')\n",
    "    database = os.environ.get('NEO4J_DB')\n",
    "\n",
    "    graph = Neo4jGraph(\n",
    "        url=url, \n",
    "        username=username, \n",
    "        password=password,\n",
    "        database = database\n",
    "    )\n",
    "\n",
    "    load_dotenv(os.path.join(os.path.expanduser('~'), '.gpt_config.env'))\n",
    "    API_KEY = os.environ.get('API_KEY')\n",
    "    API_VERSION = os.environ.get('API_VERSION')\n",
    "    RESOURCE_ENDPOINT = os.environ.get('RESOURCE_ENDPOINT')\n",
    "    openai.api_type = \"azure\"\n",
    "    openai.api_key = API_KEY\n",
    "    openai.api_base = RESOURCE_ENDPOINT\n",
    "    openai.api_version = API_VERSION\n",
    "    chat_deployment_id = LLM_MODEL\n",
    "    chat_model_id = chat_deployment_id\n",
    "    temperature = 0\n",
    "    chat_model = ChatOpenAI(openai_api_key=API_KEY, \n",
    "                            engine=chat_deployment_id, \n",
    "                            temperature=temperature)\n",
    "    chain = GraphCypherQAChain.from_llm(\n",
    "        chat_model, \n",
    "        graph=graph, \n",
    "        verbose=True, \n",
    "        validate_cypher=True,\n",
    "        return_intermediate_steps=True\n",
    "    )\n",
    "    return chain"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8b920685",
   "metadata": {},
   "source": [
    "## Initiate neo4j RAG chain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "id": "29b40370",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING! engine is not default parameter.\n",
      "                    engine was transferred to model_kwargs.\n",
      "                    Please confirm that engine is what you intended.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 14.6 ms, sys: 4.67 ms, total: 19.2 ms\n",
      "Wall time: 22.1 s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "neo4j_rag_chain = get_neo4j_cypher_rag_chain()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cfa082f8",
   "metadata": {},
   "source": [
    "## Run on test data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "172e0f96",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'childhood-onset asthma'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'RORA'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-37}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"SHANK2\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"skin benign neoplasm\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 5e-08}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'hypertrophic cardiomyopathy'}), (g:Gene {name: 'AMBRA1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'lung adenocarcinoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'CYP2A6'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 8e-11}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'idiopathic generalized epilepsy'}), (g:Gene {name: 'RYR2'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"PLCE1\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"gastric fundus cancer\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-22}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'VTI1A'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'hypertrophic cardiomyopathy'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'peptic ulcer disease'}), (g:Gene {name: 'TTC33'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'multiple sclerosis'}), (g:Gene {name: 'TSPAN31'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'large intestine cancer'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'ABHD12B'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 7e-09}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'prostate carcinoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'ESR2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 7e-12}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'inflammatory bowel disease'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'SH2B3'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 1e-09}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'mastocytosis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'FTCD'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 1e-09}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"FURIN\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"major depressive disorder\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-19}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'testicular cancer'}), (g:Gene {name: 'TERT'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS association_exists\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'association_exists': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'SLC24A3'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'type 2 diabetes mellitus'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'g': {'license': 'CC0 1.0', 'identifier': 57419, 'ensembl': 'ENSG00000185052', 'chromosome': '20', 'name': 'SLC24A3', 'description': 'solute carrier family 24 member 3', 'source': 'Entrez Gene'}, 'd': {'identifier': 'DOID:9352', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID9352 target=\"_blank\">kwgr:topic.DOID9352</a>', 'omim_list': ['601407', '125853', '603694', '608036', '601283'], 'name': 'type 2 diabetes mellitus', 'source': 'Disease Ontology', 'mesh_list': ['D003924']}}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'celiac disease'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'PLEK'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'d': {'identifier': 'DOID:10608', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID10608 target=\"_blank\">kwgr:topic.DOID10608</a>', 'omim_list': ['607202', '612006', '611598', '612011', '609754', '612008', '612009', '612005', '612007'], 'name': 'celiac disease', 'source': 'Disease Ontology', 'mesh_list': ['D002446']}, 'r': ({'identifier': 'DOID:10608', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID10608 target=\"_blank\">kwgr:topic.DOID10608</a>', 'omim_list': ['607202', '612006', '611598', '612011', '609754', '612008', '612009', '612005', '612007'], 'name': 'celiac disease', 'source': 'Disease Ontology', 'mesh_list': ['D002446']}, 'ASSOCIATES_DaG', {'identifier': 5341, 'license': 'CC0 1.0', 'ensembl': 'ENSG00000115956', 'chromosome': '2', 'name': 'PLEK', 'description': 'pleckstrin', 'source': 'Entrez Gene', 'chembl_id': 'CHEMBL4523171'}), 'g': {'identifier': 5341, 'license': 'CC0 1.0', 'ensembl': 'ENSG00000115956', 'chromosome': '2', 'name': 'PLEK', 'description': 'pleckstrin', 'source': 'Entrez Gene', 'chembl_id': 'CHEMBL4523171'}}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"endometrial carcinoma\"}), (g:Gene {name: \"CPVL\"}) \n",
      "RETURN d.name, g.name, r.gwas_pvalue\n",
      "\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'allergic disease'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'ZNF652'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'d': {'identifier': 'DOID:1205', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID1205 target=\"_blank\">kwgr:topic.DOID1205</a>', 'omim_list': [], 'name': 'allergic disease', 'source': 'Disease Ontology', 'mesh_list': ['D006967']}, 'r': ({'identifier': 'DOID:1205', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID1205 target=\"_blank\">kwgr:topic.DOID1205</a>', 'omim_list': [], 'name': 'allergic disease', 'source': 'Disease Ontology', 'mesh_list': ['D006967']}, 'ASSOCIATES_DaG', {'license': 'CC0 1.0', 'identifier': 22834, 'ensembl': 'ENSG00000198740', 'chromosome': '17', 'name': 'ZNF652', 'description': 'zinc finger protein 652', 'source': 'Entrez Gene'}), 'g': {'license': 'CC0 1.0', 'identifier': 22834, 'ensembl': 'ENSG00000198740', 'chromosome': '17', 'name': 'ZNF652', 'description': 'zinc finger protein 652', 'source': 'Entrez Gene'}}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"systemic lupus erythematosus\"})-[r:ASSOCIATES_DaG]-(g:Gene {name: \"ELF3\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 4e-09}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'GMDS'}), (d:Disease {name: 'hemorrhoid'}) \n",
      "RETURN EXISTS((g)-[:ASSOCIATES_DaG]->(d)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': False}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'rheumatoid arthritis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'DPP4'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-21}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"SMAD7\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"colon carcinoma\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-08}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'PKIA'})-[r:ASSOCIATES_DaG]->(d:Disease {name: 'pulmonary hypertension'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'autoimmune thyroiditis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'TNFRSF14'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-11}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'psoriatic arthritis'}), (g:Gene {name: 'CNTNAP2'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'primary biliary cholangitis'}), (g:Gene {name: 'CCDC88B'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"MARK3\"})-[:ASSOCIATES_DaG]->(d:Disease {name: \"otosclerosis\"}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"RHPN2\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"large intestine cancer\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 4e-41}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'anxiety disorder'}), (g:Gene {name: 'NTRK2'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'atopic dermatitis'}), (g:Gene {name: 'RERE'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'PRR5L'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'asthma'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'gastric fundus cancer'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'GON4L'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 1e-15}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'type 2 diabetes mellitus'}), (g:Gene {name: 'DNAH1'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS isAssociated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'isAssociated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'schizophrenia'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'SLC17A3'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-20}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'inflammatory bowel disease'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'FADS2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-15}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'opiate dependence'}), (g:Gene {name: 'ADGRV1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"attention deficit hyperactivity disorder\"})-[r:ASSOCIATES_DaG]-(g:Gene {name: \"ST3GAL3\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 8e-14}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'C3orf49'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'cataract'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'g': {'license': 'CC0 1.0', 'identifier': 132200, 'ensembl': 'ENSG00000163632', 'chromosome': '3', 'name': 'C3orf49', 'description': 'chromosome 3 open reading frame 49', 'source': 'Entrez Gene'}, 'd': {'identifier': 'DOID:83', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID83 target=\"_blank\">kwgr:topic.DOID83</a>', 'omim_list': ['PS116200', '601371'], 'name': 'cataract', 'source': 'Disease Ontology', 'mesh_list': []}}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'PLD1'})-[r:ASSOCIATES_DaG]-(d:Disease {name: 'duodenal ulcer'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 5e-08}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'CHRNA3'}), (d:Disease {name: 'chronic obstructive pulmonary disease'})-[r:ASSOCIATES_DaG]->(g) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 5e-28}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'pancreatic carcinoma'}), (g:Gene {name: 'CCDC68'}) \n",
      "RETURN d.name, g.name, r.gwas_pvalue\n",
      "\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'HLA-DPB1'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'primary biliary cholangitis'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'atopic dermatitis'}), (g:Gene {name: 'GABPB2'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'HIP1'})-[r:ASSOCIATES_DaG]-(d:Disease {name: 'systemic lupus erythematosus'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 6e-62}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'hypothyroidism'}), (g:Gene {name: 'TIMMDC1'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'degenerative myopia'}), (g:Gene {name: 'MIPEP'})\n",
      "RETURN d.name, g.name, r.gwas_pvalue\n",
      "\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'alcoholic pancreatitis'}), (g:Gene {name: 'CASP9'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS association_exists\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'association_exists': True}]\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'lung squamous cell carcinoma'}), (g:Gene {name: 'PDS5B'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'common variable immunodeficiency'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'CLEC16A'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-09}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'TERT'}), (d:Disease {name: 'lung non-small cell carcinoma'}) \n",
      "RETURN EXISTS((g)-[:ASSOCIATES_DaG]->(d)) AS association_exists\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'association_exists': False}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'PSMD3'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'cardiovascular system disease'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'gestational diabetes'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'CCND2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-12}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"TMEM106B\"})-[:ASSOCIATES_DaG]->(d:Disease {name: \"major depressive disorder\"}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"COL6A1\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"keratoconus\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 9e-12}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'chronic lymphocytic leukemia'}), (g:Gene {name: 'RREB1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS association_exists\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'association_exists': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'PARPBP'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'prostate carcinoma'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"testicular germ cell cancer\"})-[r:ASSOCIATES_DaG]->(g:Gene {name: \"ZFP64\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-12}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"KLF13\"})-[r:ASSOCIATES_DaG]->(d:Disease {name: \"psoriasis\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'coronary artery disease'}), (g:Gene {name: 'ADGRL3'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"abdominal obesity-metabolic syndrome 1\"})-[r:ASSOCIATES_DaG]->(g:Gene {name: \"JMJD1C\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-14}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'CUX2'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'type 1 diabetes mellitus'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'g': {'license': 'CC0 1.0', 'identifier': 23316, 'ensembl': 'ENSG00000111249', 'chromosome': '12', 'name': 'CUX2', 'description': 'cut like homeobox 2', 'source': 'Entrez Gene'}, 'd': {'identifier': 'DOID:9744', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID9744 target=\"_blank\">kwgr:topic.DOID9744</a>', 'omim_list': ['222100'], 'name': 'type 1 diabetes mellitus', 'source': 'Disease Ontology', 'mesh_list': ['D003922']}}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'KCNK16'})-[r:ASSOCIATES_DaG]-(d:Disease {name: 'type 2 diabetes mellitus'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 4e-17}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'type 1 diabetes mellitus'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'DGKQ'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'d': {'identifier': 'DOID:9744', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID9744 target=\"_blank\">kwgr:topic.DOID9744</a>', 'omim_list': ['222100'], 'name': 'type 1 diabetes mellitus', 'source': 'Disease Ontology', 'mesh_list': ['D003922']}, 'r': ({'identifier': 'DOID:9744', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID9744 target=\"_blank\">kwgr:topic.DOID9744</a>', 'omim_list': ['222100'], 'name': 'type 1 diabetes mellitus', 'source': 'Disease Ontology', 'mesh_list': ['D003922']}, 'ASSOCIATES_DaG', {'license': 'CC0 1.0', 'identifier': 1609, 'ensembl': 'ENSG00000145214', 'chromosome': '4', 'name': 'DGKQ', 'description': 'diacylglycerol kinase theta', 'source': 'Entrez Gene'}), 'g': {'license': 'CC0 1.0', 'identifier': 1609, 'ensembl': 'ENSG00000145214', 'chromosome': '4', 'name': 'DGKQ', 'description': 'diacylglycerol kinase theta', 'source': 'Entrez Gene'}}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"SIX6\"})-[r:ASSOCIATES_DaG]->(d:Disease {name: \"refractive error\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"MAP4K4\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"Parkinson's disease\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 8e-13}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'autism spectrum disorder'}), (g:Gene {name: 'DCC'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'multiple sclerosis'}), (g:Gene {name: 'NR1D1'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'coronary artery disease'}), (g:Gene {name: 'SMAD3'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'ANO7'})-[r:ASSOCIATES_DaG]->(d:Disease {name: 'prostate carcinoma'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'ovarian carcinoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'FGFR2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 4e-254}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'lymphoid leukemia'}), (g:Gene {name: 'BMF'})\n",
      "RETURN d.gwas_pvalue AS GWAS_p_value\n",
      "\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'GWAS_p_value': None}]\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'Skin Melanoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'CYP1B1'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'myositis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'ATP6V1G2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 6e-49}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"SPG7\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"melanoma\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 9e-26}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'EYA2'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'type 2 diabetes mellitus'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"SERPINA1\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"carpal tunnel syndrome\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-24}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'substance-related disorder'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'FUT2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-19}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'open-angle glaucoma'}), (g:Gene {name: 'PLEKHA7'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS IsAssociated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'IsAssociated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'myocardial infarction'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'ZNF831'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 1e-08}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'IRF4'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'squamous cell carcinoma'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'WDHD1'})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"Parkinson's disease\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 4e-16}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'cataract'}), (g:Gene {name: 'TOP1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'atrial fibrillation'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'AGBL4'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-09}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'otosclerosis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'SEMA4D'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 4e-09}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'hypothyroidism'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'RAD51B'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-11}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"SPSB1\"})-[r:ASSOCIATES_DaG]->(d:Disease {name: \"childhood-onset asthma\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'major depressive disorder'}), (g:Gene {name: 'ATG7'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'WNT10A'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'alopecia'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'g': {'license': 'CC0 1.0', 'identifier': 80326, 'ensembl': 'ENSG00000135925', 'chromosome': '2', 'name': 'WNT10A', 'description': 'Wnt family member 10A', 'source': 'Entrez Gene'}, 'd': {'identifier': 'DOID:987', 'Linkout': '<a href=https://staging.knowwheregraph.org/browse/#kwgr:topic.DOID987 target=\"_blank\">kwgr:topic.DOID987</a>', 'omim_list': ['PS203655'], 'name': 'alopecia', 'source': 'Disease Ontology', 'mesh_list': ['D000505']}}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'inflammatory bowel disease'}), (g:Gene {name: 'IL27'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'tonsillitis'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'TNFRSF13B'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 8e-26}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'cleft lip'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'SFI1'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 3e-08}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"multiple sclerosis\"})-[r:ASSOCIATES_DaG]->(g:Gene {name: \"INAVA\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 6e-21}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'esophageal carcinoma'}), (g:Gene {name: 'CASP8'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'Skin Melanoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'GPRC5A'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'lung squamous cell carcinoma'}), (g:Gene {name: 'BRCA2'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'systemic lupus erythematosus'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'HLA-DRA'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 2e-60}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'type 2 diabetes mellitus'}), (g:Gene {name: 'UBE2E2'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'is_associated': True}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'allergic rhinitis'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'HLA-DQA1'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 1e-43}]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'systemic lupus erythematosus'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'HLA-DQA1'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[{'r.gwas_pvalue': 1e-54}]\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "CPU times: user 3.59 s, sys: 295 ms, total: 3.88 s\n",
      "Wall time: 9min 27s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "\n",
    "neo4j_rag_answer = []\n",
    "total_tokens_used = []\n",
    "\n",
    "for index, row in data.iterrows():\n",
    "    question = row['question']\n",
    "    with get_openai_callback() as cb:\n",
    "        try:\n",
    "            neo4j_rag_answer.append(neo4j_rag_chain.run(query=question, return_final_only=True, verbose=False))\n",
    "        except ValueError as e:\n",
    "            neo4j_rag_answer.append(None)\n",
    "    total_tokens_used.append(cb.total_tokens)\n",
    "\n",
    "data.loc[:,'neo4j_rag_answer'] = neo4j_rag_answer\n",
    "data.loc[:, 'total_tokens_used'] = total_tokens_used\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9cd8b31b",
   "metadata": {},
   "source": [
    "## Run on perturbed test data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "id": "8e603e8f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'childhood-onset asthma'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'rora'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'skin benign neoplasm'}), (g:Gene {name: 'shank2'}), (d)-[r:ASSOCIATES_DaG]->(g) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'hypertrophic cardiomyopathy'}), (g:Gene {name: 'ambra1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'lung adenocarcinoma'}), (g:Gene {name: 'cyp2a6'})\n",
      "MATCH (d)-[r:ASSOCIATES_DaG]->(g)\n",
      "RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"idiopathic generalized epilepsy\"}), (g:Gene {name: \"ryr2\"}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'gastric fundus cancer'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'plce1'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'vti1a'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'hypertrophic cardiomyopathy'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'peptic ulcer disease'}), (g:Gene {name: 'ttc33'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'multiple sclerosis'}), (g:Gene {name: 'tspan31'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"abhd12b\"})-[:ASSOCIATES_DaG {disease: \"large intestine cancer\"}]->(d:Disease) RETURN g.gwas_pvalue as GWAS_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'prostate carcinoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'esr2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'inflammatory bowel disease'}), (g:Gene {name: 'sh2b3'}), (d)-[r:ASSOCIATES_DaG]->(g) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'mastocytosis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'ftcd'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"furin\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"major depressive disorder\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'testicular cancer'}), (g:Gene {name: 'tert'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"slc24a3\"})-[:ASSOCIATES_DaG]-(d:Disease {name: \"type 2 diabetes mellitus\"}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'celiac disease'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'plek'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"endometrial carcinoma\"}), (g:Gene {name: \"cpvl\"}) \n",
      "RETURN d.name, g.name, r.gwas_pvalue\n",
      "\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'allergic disease'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'znf652'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"systemic lupus erythematosus\"})-[r:ASSOCIATES_DaG]-(g:Gene {name: \"elf3\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'gmds'}), (d:Disease {name: 'hemorrhoid'}) \n",
      "RETURN EXISTS((g)-[:ASSOCIATES_DaG]->(d)) AS isAssociated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'rheumatoid arthritis'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'dpp4'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"smad7\"})-[:ASSOCIATES_DaG {gwas_pvalue: pvalue}]->(d:Disease {name: \"colon carcinoma\"}) RETURN pvalue\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'pkia'})-[r:ASSOCIATES_DaG]->(d:Disease {name: 'pulmonary hypertension'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'autoimmune thyroiditis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'tnfrsf14'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'psoriatic arthritis'}), (g:Gene {name: 'cntnap2'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS association_exists\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'primary biliary cholangitis'}), (g:Gene {name: 'ccdc88b'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'mark3'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'otosclerosis'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"rhpn2\"})-[:ASSOCIATES_DaG {gwas_pvalue: pvalue}]->(d:Disease {name: \"large intestine cancer\"}) RETURN pvalue\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'anxiety disorder'}), (g:Gene {name: 'ntrk2'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'atopic dermatitis'}), (g:Gene {name: 'rere'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'prr5l'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'asthma'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'gastric fundus cancer'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'gon4l'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'type 2 diabetes mellitus'}), (g:Gene {name: 'dnah1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS isAssociated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'schizophrenia'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'slc17a3'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'inflammatory bowel disease'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'fads2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'Opiate Dependence'}), (g:Gene {name: 'ADGRV1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"attention deficit hyperactivity disorder\"})-[r:ASSOCIATES_DaG]-(g:Gene {name: \"st3gal3\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'c3orf49'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'cataract'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'pld1'})-[r:ASSOCIATES_DaG]-(d:Disease {name: 'duodenal ulcer'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'chrna3'})-[r:ASSOCIATES_DaG]-(d:Disease {name: 'chronic obstructive pulmonary disease'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'pancreatic carcinoma'}), (g:Gene {name: 'ccdc68'}) \n",
      "RETURN d.name, g.name, r.gwas_pvalue\n",
      "\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'primary biliary cholangitis'}), (g:Gene {name: 'hla-dpb1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'atopic dermatitis'}), (g:Gene {name: 'gabpb2'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'systemic lupus erythematosus'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'hip1'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'hypothyroidism'}), (g:Gene {name: 'timmdc1'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'degenerative myopia'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'mipep'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'alcoholic pancreatitis'}), (g:Gene {name: 'casp9'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'lung squamous cell carcinoma'}), (g:Gene {name: 'pds5b'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'common variable immunodeficiency'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'clec16a'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'tert'}), (d:Disease {name: 'lung non-small cell carcinoma'}) \n",
      "RETURN EXISTS((g)-[:ASSOCIATES_DaG]->(d)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'psmd3'})-[:ASSOCIATES_DaG]->(d:Disease {name: 'cardiovascular system disease'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'gestational diabetes'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'ccnd2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'tmem106b'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'major depressive disorder'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'col6a1'})-[r:ASSOCIATES_DaG]-(d:Disease {name: 'keratoconus'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'chronic lymphocytic leukemia'}), (g:Gene {name: 'rreb1'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS IsAssociated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'Prostate Carcinoma'}), (g:Gene {name: 'PARPBP'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS isAssociated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"testicular germ cell cancer\"})-[r:ASSOCIATES_DaG]->(g:Gene {name: \"zfp64\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'klf13'})-[r:ASSOCIATES_DaG]->(d:Disease {name: 'psoriasis'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"coronary artery disease\"}), (g:Gene {name: \"adgrl3\"}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"abdominal obesity-metabolic syndrome 1\"})-[r:ASSOCIATES_DaG]->(g:Gene {name: \"jmjd1c\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'cux2'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'type 1 diabetes mellitus'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'kcnk16'})-[r:ASSOCIATES_DaG]->(d:Disease {name: 'type 2 diabetes mellitus'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'type 1 diabetes mellitus'}), (g:Gene {name: 'dgkq'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS isAssociated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"six6\"})-[r:ASSOCIATES_DaG]->(d:Disease {name: \"refractive error\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'map4k4'})-[r:ASSOCIATES_DaG]-(d:Disease {name: 'parkinson\\'s disease'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'autism spectrum disorder'}), (g:Gene {name: 'dcc'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS isAssociated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'multiple sclerosis'}), (g:Gene {name: 'nr1d1'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'coronary artery disease'}), (g:Gene {name: 'smad3'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"ANO7\"})-[r:ASSOCIATES_DaG]->(d:Disease {name: \"Prostate Carcinoma\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'ovarian carcinoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'fgfr2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'lymphoid leukemia'}), (g:Gene {name: 'bmf'})\n",
      "RETURN d.gwas_pvalue AS GWAS_p_value\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'Skin Melanoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'CYP1B1'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'myositis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'atp6v1g2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"spg7\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"melanoma\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'eya2'}), (d:Disease {name: 'type 2 diabetes mellitus'}) RETURN EXISTS((g)-[:ASSOCIATES_DaG]->(d)) AS association_exists\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"serpina1\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"carpal tunnel syndrome\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'substance-related disorder'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'fut2'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'open-angle glaucoma'}), (g:Gene {name: 'plekha7'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'myocardial infarction'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'znf831'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'irf4'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'squamous cell carcinoma'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'wdhd1'})-[r:ASSOCIATES_DaG]-(d:Disease {name: 'parkinson\\'s disease'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'cataract'}), (g:Gene {name: 'top1'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'atrial fibrillation'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'agbl4'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'otosclerosis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'sema4d'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'hypothyroidism'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'rad51b'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: \"spsb1\"})-[r:ASSOCIATES_DaG]-(d:Disease {name: \"childhood-onset asthma\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'major depressive disorder'}), (g:Gene {name: 'atg7'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (g:Gene {name: 'wnt10a'})-[:ASSOCIATES_DaG]-(d:Disease {name: 'alopecia'}) RETURN g, d\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'inflammatory bowel disease'}), (g:Gene {name: 'il27'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'tonsillitis'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'tnfrsf13b'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'cleft lip'})-[r:ASSOCIATES_DaG]->(g:Gene {name: 'sfi1'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"multiple sclerosis\"})-[r:ASSOCIATES_DaG]-(g:Gene {name: \"inava\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'esophageal carcinoma'}), (g:Gene {name: 'casp8'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'Skin Melanoma'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'GPRC5A'}) RETURN d, r, g\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'lung squamous cell carcinoma'}), (g:Gene {name: 'brca2'}) \n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'systemic lupus erythematosus'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'hla-dra'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'type 2 diabetes mellitus'}), (g:Gene {name: 'ube2e2'})\n",
      "RETURN EXISTS((d)-[:ASSOCIATES_DaG]->(g)) AS is_associated\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: 'allergic rhinitis'})-[r:ASSOCIATES_DaG]-(g:Gene {name: 'hla-dqa1'}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "\n",
      "\n",
      "\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
      "Generated Cypher:\n",
      "\u001b[32;1m\u001b[1;3mMATCH (d:Disease {name: \"systemic lupus erythematosus\"})-[r:ASSOCIATES_DaG]->(g:Gene {name: \"hla-dqa1\"}) RETURN r.gwas_pvalue\u001b[0m\n",
      "Full Context:\n",
      "\u001b[32;1m\u001b[1;3m[]\u001b[0m\n",
      "\n",
      "\u001b[1m> Finished chain.\u001b[0m\n",
      "CPU times: user 3.52 s, sys: 292 ms, total: 3.81 s\n",
      "Wall time: 9min 8s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "\n",
    "neo4j_rag_answer = []\n",
    "total_tokens_used = []\n",
    "\n",
    "for index, row in data.iterrows():\n",
    "    question = row['question_perturbed']\n",
    "    with get_openai_callback() as cb:\n",
    "        try:\n",
    "            neo4j_rag_answer.append(neo4j_rag_chain.run(query=question, return_final_only=True, verbose=False))\n",
    "        except ValueError as e:\n",
    "            neo4j_rag_answer.append(None)\n",
    "    total_tokens_used.append(cb.total_tokens)\n",
    "\n",
    "data.loc[:,'neo4j_rag_answer_perturbed'] = neo4j_rag_answer\n",
    "data.loc[:, 'total_tokens_used_perturbed'] = total_tokens_used\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5ea4a4a9",
   "metadata": {},
   "source": [
    "## Save the result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "id": "27ea4be4",
   "metadata": {},
   "outputs": [],
   "source": [
    "save_path = '../data/results'\n",
    "os.makedirs(save_path, exist_ok=True)\n",
    "data.to_csv(os.path.join(save_path, 'cypher_rag_output.csv'), index=False)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8f956d94",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
